<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
//use yii\bootstrap\ActiveForm;
?>
<!--
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta name="keywords" content="首页关键字" />
  <meta name="description" content="首页描述" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Cache-Control" content="no-cache" />
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=2.0" />
  <meta name="apple-mobile-web-app-capable" content="yes"/>
  
  <link rel="stylesheet" href="resources/css/weui/weui.min.css">
  <link rel="stylesheet" href="resources/css/main.min.css">
  <link rel="stylesheet" href="resources/css/man.min.css">
  
  <script src="resources/js/jquery-1.10.min.js"></script>
  <script src="resources/js/jquery.touchSwipe.min.js"></script>
  <script src="resources/js/frmwebm.min.js"></script>
  <title>所在区域编辑</title>
  <style>
  .weui_label{
    font-size:15px;
  }
  </style>
</head>
<body style="background: #ebebeb none repeat scroll 0 0;">
-->
<!--
	<form id="form">
-->
<?php $this->title = '所在区域编辑' ?>

<?php $form = ActiveForm::begin([
    'id' => 'form',
    'fieldConfig' => [
        'template' => "{input}",
        'options' => ['tag' => false],
    ],
]); ?>

	<div class="weui_cells" style="margin-top: 0px;">
		<div class="weui_cell" style="background:#646365;">
			<div id="back" class="weui_cell_bd weui_cell_primary">
				<img style="height:18px" src="resources/images/u7.png">
			</div>
			<div onclick="save()" class="weui_cell_ft" style="color:#ffffff;">保存</div>
		</div>
		

        <div class="weui_form_item">
            <label class="weui_form_label">所在区域<span style="color:red;"> *</span></label>
            <div class="weui_form_inputBox">
            <?php echo $form->field($model, 'parent_area_id')->dropDownList(\yii\helpers\ArrayHelper::map(
                \common\models\MktArea::find()->children()->all(),
                'id',
                'title'
            ), ['prompt'=>'选择区域...', 'id'=>'parent_area_id', 'class'=>'weui_form_input', 'style'=>'width:100%;color:#A5A5A5;']); ?>
            </div>

            <div class="weui_form_inputBox">
            <?php echo $form->field($model, 'area_id')->label('商圈')->widget(\kartik\depdrop\DepDrop::classname(), [
                 'options' => ['id' => 'area_id', 'class'=>'weui_form_input', 'style'=>'width:100%;color:#A5A5A5;'],
                 'pluginOptions'=>[
                     'depends'=>['parent_area_id'],
                     'placeholder' => '选择商圈...',
                     'url' => Url::to(['area-subcat']),
                     'initialize' => $model->isNewRecord ? false : true,                     
                     //'url' => Url::to('@backendUrl/index.php?r=area/subcat'),
                 ]
             ]); ?>
            </div>
        </div>

		<div class="weui_progress" style="margin-left: 15px; margin-right: 15px;margin-top: -10px;">
			<div class="weui_progress_bar" style="background-color: #ffffff;">
				<div style="width: 100%; height: 1px;" class="weui_progress_inner_bar js_progress"></div>
			</div>
		</div>
		
		<article class="weui_article" style="color: #999999;font-size:14px;background: #ffffff none repeat scroll 0 0;">
			<div style="margin:5px;"></div>
		</article>
	</div>

<!--    
	</form>
-->
<?php ActiveForm::end(); ?>

	<div class="weui_msg">
	</div>
	
	<div class="weui_msg">
	</div>

<script type="text/javascript">

$('#back').click(function(){ parent.history.back(); return false; });

function save()
{
    var args = {
        'classname': '\\common\\models\\MktUser',
        'funcname': 'modifyAreaAjax',
        'params': {
            'id': '<?= $model->id ?>',
            'area_id': $('#area_id').val()
        }
    };

    $.ajax({
        url: "<?= Url::to(['/wap/ajax-broker']); ?>",
        type: "GET",
        cache: false,
        dataType: "json",
        data: "args=" + JSON.stringify(args),
        success: function (ret) {
            if (0 === ret['code']) {
                frmwebm.toast('保存成功', 2000);
                setTimeout(function () {
                    parent.history.back();
                }, 2000);
            }
            else {
                frmwebm.prompt({
                    title: "温馨提示",
                    content: ret['msg']
                });
            }
        },
        error: function () {
            frmwebm.prompt({ content: "系统错误"});
        }
    });
    
    return false;
}
</script>

<!--
</body>
</html>
-->

<?php
/*
		<div class="weui_cell" style="padding-top: 25px;">

			<div class="weui_cell_hd">
				<label class="weui_label">所在区域</label>
			</div>
			<div class="weui_cell_bd weui_cell_primary">
				<input type="text" class="weui_input" id="area_id_info" value="<?= $model->area_id; ?>">
			</div>
		</div>


*/